package com.tcm.logistics.service.impl;

import com.tcm.logistics.dao.mapper.LogisticsFreightProvisoMapper;
import com.tcm.logistics.entity.LogisticsFreightProviso;
import com.tcm.logistics.service.LogisticsFreightProvisoService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 免运费条件
 */
@DubboService(version = "0.0.1-alpha")
public class LogisticsFreightProvisoServiceImpl implements LogisticsFreightProvisoService {

    @Autowired
    private LogisticsFreightProvisoMapper logisticsFreightProvisoMapper;

    /**
     * 免运费条件
     *
     * @param freightId
     * @return
     */
    @Override
    public List<LogisticsFreightProviso> listProviso(Long freightId) {
        return logisticsFreightProvisoMapper.listProviso(freightId);
    }

    /**
     * 新增免运费条件
     *
     * @param proviso
     */
    @Override
    public void create(LogisticsFreightProviso proviso) {
        logisticsFreightProvisoMapper.insert(proviso);
    }

    /**
     * 更新免运费条件
     *
     * @param proviso
     */
    @Override
    public void update(LogisticsFreightProviso proviso) {
        logisticsFreightProvisoMapper.updateByKey(proviso);
    }

    /**
     * 逻辑删除
     *
     * @param id
     * @return
     */
    @Override
    public int deleteLogicById(Long id) {
        return logisticsFreightProvisoMapper.deleteLogicByKey(id);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Override
    public int deleteById(Long id) {
        return logisticsFreightProvisoMapper.deleteByKey(id);
    }

    /**
     * 删除免运费条件
     *
     * @param freightId
     * @return
     */
    @Override
    public int deleteByFreight(Long freightId) {
        return logisticsFreightProvisoMapper.deleteByFreight(freightId);
    }

    /**
     * 逻辑删除免运费条件
     *
     * @param freightId
     * @return
     */
    @Override
    public int deleteLogicByFreight(Long freightId) {
        return logisticsFreightProvisoMapper.deleteLogicByFreight(freightId);
    }
}
